Show:

ia.BoundingBox Class

Module: ia

An area defined by its position, as indicated by its bottom-left corner point (xMin, yMin) and by its top-right corner point (xMax, yMax).

Constructor

ia.BoundingBox

(
  • [xMin=0]
  • [yMin=0]
  • [xMax=100]
  • [yMax=100]
)

Parameters:

  • [xMin=0] Number optional

    The x-coord of the bottom-left corner.

  • [yMin=0] Number optional

    The y-coord of the bottom-left corner.

  • [xMax=100] Number optional

    The x-coord of the top-right corner.

  • [yMax=100] Number optional

    The y-coord of the top-right corner.

Methods

bottom

() Number

Returns the bottom coord.

Returns:

Number: The coordinate.

clone

() ia.BoundingBox

Gets a clone of this bounding box.

Returns:

ia.BoundingBox: The bounding box.

contains

(
  • bBox
)
Boolean

Tests whether a bounding box is contained within this one.

Parameters:

Returns:

Boolean: true if bounding box is contained within this one, otherwise false.

equals

(
  • bBox
)
Boolean

Tests whether a bounding box is equal to this one.

Parameters:

Returns:

Boolean: true if bounding box is equal to this one, otherwise false.

getHeight

() Number

Returns the height of the bounding box.

Returns:

Number: The height.

getWidth

() Number

Returns the width of the bounding box.

Returns:

Number: The width.

getXCenter

() Number

Returns the x-coord of the center of the bounding box.

Returns:

Number: The coordinate.

getXMax

() Number

Returns the x-coord of the right edge of the bounding box.

Returns:

Number: The coordinate.

getXMin

() Number

Returns the x-coord of the left edge of the bounding box.

Returns:

Number: The coordinate.

getYCenter

() Number

Returns the y-coord of the center of the bounding box.

Returns:

Number: The coordinate.

getYMax

() Number

Returns the y-coord of the top edge of the bounding box.

Returns:

Number: The coordinate.

getYMin

() Number

Returns the y-coord of the bottom edge of the bounding box.

Returns:

Number: The coordinate.

intersects

(
  • bBox
)
Boolean

Tests whether a bounding box intersects this one.

Parameters:

Returns:

Boolean: true if bounding bounding boxes intercept, otherwise false.

left

() Number

Returns the left coord.

Returns:

Number: The coordinate.

right

() Number

Returns the right coord.

Returns:

Number: The coordinate.

setHeight

(
  • h
)

Sets the height of the bounding box.

Parameters:

  • h Number

    The height.

setWidth

(
  • w
)

Sets the width of the bounding box.

Parameters:

  • w Number

    The width.

setXCenter

(
  • x
)

Sets the x-coord of the center of the bounding box.

Parameters:

  • x Number

    The coordinate.

setXMax

(
  • x
)

Sets the x-coord of the right edge of the bounding box.

Parameters:

  • x Number

    The coordinate.

setXMin

(
  • x
)

Sets the x-coord of the left edge of the bounding box.

Parameters:

  • x Number

    The coordinate.

setYCenter

(
  • y
)

Sets the y-coord of the center of the bounding box.

Parameters:

  • y Number

    The coordinate.

setYMax

(
  • y
)

Sets the y-coord of the top edge of the bounding box.

Parameters:

  • y Number

    The coordinate.

setYMin

(
  • y
)

Sets the y-coord of the bottom edge of the bounding box.

Parameters:

  • y Number

    The coordinate.

top

() Number

Returns the top coord.

Returns:

Number: The coordinate.

toString

() String

Gets a simple text representation of this bounding box.

Returns:

String: A text String.